<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="content-language" content="zh-CN">
    <meta content="1 days" name="revisit-after" />
    <meta name="robots" content="all">
    <meta name="viewport" content="width=750, maximum-scale=1.0, user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <meta content="false" id="twcClient" name="twcClient" />
    <link rel="stylesheet" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/doctor.css">
    <script src="js/common.js"></script>
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="js/swiper.min.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <title>医院</title>
</head>

<body>
    <div id="pro">
        <header>
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <div class="swiper-slide"  v-for="banner in doctorDetail.gallery">
                        <img :src="banner.photo+'/750'" alt="">
                    </div>
                </div>
                <div class="swiper-pagination"></div>
            </div>
        </header>
        <main>
            <div class="local">
                <div class="left">
                    <div class="row1">{{doctorDetail.name}}</div>
                    <div class="row2" v-if="model=='hospitals'">{{doctorDetail.address}}</div>
                    <div class="row2" v-if="model=='doctors'" v-for="item in doctorDetail.hosp_list">{{item.address}}</div>
                    <div class="row3">客服电话:
                        <a href="tel:13126887722">13126887722</a>
                    </div>
                </div>
                <div class="right" @click.stop="showLocation">
                    导航
                </div>
            </div>
            <div class="time">
                <span>{{doctorDetail.opening_time}}</span>
                <span>周一至周日(需和客服小美提前预约)</span>
            </div>
            <div class="desc">
                <div class="title">
                    专业服务内容
                </div>
                <div class="con" v-if="model=='hospitals'" v-html="requestText">
                </div>
                <div class="con" v-if="model=='doctors'" v-html="doctorDetail.intro"></div>
            </div>
            <div class="server"  v-if="id != 597">
                <img src="images/code.png" alt="">
                <div class="row1">长按识别二维码联系客服</div>
            </div>

            <div class="server"  v-if="id == 597">
                <img src="images/miniCode.jpg" alt="">
                <div class="row1">长按识别小程序码</div>
            </div>
        </main>
    </div>

</body>

</html>
<script>
    var app4 = new Vue({
        el: '#pro',
        data() {
            return {
                doctorDetail: '',
                model: '',
                id:'',
                SetFun:'',
                requestText:''
            };
        },
        methods: {
            getParam(paramName) {
                paramValue = "", isFound = !1;
                if (window.location.search.indexOf("?") == 0 && window.location.search.indexOf("=") > 1) {
                    arrSource = unescape(window.location.search).substring(1, window.location.search.length).split("&"), i = 0;
                    while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
                }
                return paramValue == "" && (paramValue = null), paramValue
            },

            goPro() {
                location.href = "doctor.html"
            },
            Params() {
                var _self = this;
                var id = this.getParam('id');
                 _self.id = id;
                var model = this.getParam('model');
                this.model = model;
                axios.get('http://airen.2020-2020.com/v1/' + model + '/' + id)
                    .then(function (res) {
                        _self.doctorDetail = res.data.data;
                        _self.$nextTick(function(){
                            var swiper = new Swiper('.swiper-container', {
                            autoplay: true,
                            speed: 300,
                            autoplay: {
                                delay: 2000,
                                disableOnInteraction: false
                            },
                            loop: true,
                            pagination: {
                                el: '.swiper-pagination',
                            },
                        });
                        })
                        var  reg=new RegExp("\n","g"); 
                           var  str= _self.doctorDetail.description.replace(reg,"<br>");
                           _self.requestText=str; 
                        document.title = _self.doctorDetail.name;
                    })
                    .catch(function (err) {
                        console.log(err);
                    })
            },
            showLocation() {
                var address;
                var detailAdsress;
                var latitude;
                var longitude;
                if (this.model == 'hospitals') {
                    latitude = parseFloat(this.doctorDetail.latitude);
                    longitude = parseFloat(this.doctorDetail.longitude);
                    address = this.doctorDetail.name;
                    detailAdsress = this.doctorDetail.address;
                } else if (this.model == 'doctors') {
                    address = this.doctorDetail.hosp_list[0].name;
                    detailAdsress = this.doctorDetail.hosp_list[0].address;
                    latitude = parseFloat(this.doctorDetail.hosp_list[0].latitude);
                    longitude = parseFloat(this.doctorDetail.hosp_list[0].longitude);
                }
                wx.ready(function () {
                    wx.openLocation({
                        latitude: latitude, // 纬度，浮点数，范围为90 ~ -90
                        longitude:longitude, // 经度，浮点数，范围为180 ~ -180。
                        name: address, // 位置名
                        address: detailAdsress, // 地址详情说明
                        scale: 13, // 地图缩放级别,整形值,范围从1~28。默认为最大
                        infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
                    });
                });
            },
            getLocation() {
                var url = window.location.href.split('#')[0];
                const appid = "wx32726bfb51bf1d44";
                axios.get("http://airen.2020-2020.com/v1/token/js_sign?appid=" + appid + '&url=' + url)
                    .then(function (response) {
                        console.log(response.data.data);
                        var res = response.data.data;
                        wx.config(res);
                    })
            }
        },
        created() {

        },
        mounted() {
            var _self = this;
            this.SetFun = new window.SetFun();
            this.SetFun.goShare(false,{
                desc: '聚合靠谱专家，配备最好设备，抛弃繁文缛节的程序，用最少花费，一步到位。'
            })
            this.getLocation();
            this.Params();
        },
    })
</script>